// 品牌图标补充模块：对 @mdi/js 图标集的扩展与统一出口
// 品牌图标路径来源：simpleicons.org（24x24 viewBox 的 path 字符串）

import {
  mdiAccount,
  mdiAccountMultiple,
  mdiCalendar,
  mdiEmail,
  mdiFacebook,
  mdiLinkedin,
  mdiPhone,
  mdiSkypeBusiness,
  mdiWechat,
  mdiWhatsapp
} from '@mdi/js'

import type { NoteType } from './types'

// 品牌图标路径（单色），来源 Simple Icons
export const PATH_TELEGRAM =
  'm9.5593,18.76585l0.28501,-4.30562l7.81729,-7.0437c0.34608,-0.31554 -0.07125,-0.46822 -0.5293,-0.1934l-9.64946,6.09708l-4.17329,-1.32324c-0.89573,-0.25447 -0.90591,-0.87537 0.20358,-1.32324l16.25548,-6.27012c0.74305,-0.3359 1.45556,0.18322 1.17056,1.32324l-2.76862,13.03899c-0.1934,0.92627 -0.75323,1.1502 -1.52681,0.72269l-4.21401,-3.1147l-2.02557,1.9645c-0.23411,0.23411 -0.42751,0.42751 -0.84484,0.42751z'

export const PATH_X =
  'm13.51709,10.75183l5.93729,-6.90092l-1.40708,0l-5.15498,5.9923l-4.11733,-5.9923l-4.74888,0l6.2259,9.06111l-6.2259,7.23707l1.40708,0l5.44359,-6.32777l4.34822,6.32777l4.74888,0l-6.4568,-9.39726zm-1.92658,2.24032l-0.63088,-0.90251l-5.01984,-7.17935l2.16087,0l4.05078,5.794l0.63088,0.90251l5.26567,7.53112l-2.16087,0l-4.29661,-6.14577z'

export const PATH_QQ =
  'm19.69658,14.4864a32.76864,32.76864 0 0 0 -0.65783,-1.8547l-0.88393,-2.20779c0.00082,-0.02621 0.01147,-0.4604 0.01147,-0.68486c-0.00082,-3.77495 -1.78261,-7.56955 -6.16624,-7.56955s-6.16542,3.79461 -6.16542,7.57037c0,0.22447 0.01065,0.65865 0.01147,0.68486l-0.88475,2.20779a31.94942,31.94942 0 0 0 -0.65701,1.8547c-0.83642,2.68949 -0.56526,3.80362 -0.35882,3.8282c0.44238,0.05325 1.72281,-2.0251 1.72281,-2.0251c0,1.20343 0.61933,2.77468 1.9612,3.90848c-0.50136,0.15401 -1.11659,0.3924 -1.51145,0.68405c-0.35554,0.26215 -0.31048,0.52921 -0.24658,0.63735c0.28099,0.47351 4.81945,0.30229 6.12937,0.15483c1.31075,0.14746 5.8492,0.31867 6.13019,-0.15483c0.0639,-0.10814 0.10814,-0.3752 -0.24658,-0.63735c-0.39568,-0.29164 -1.01009,-0.52921 -1.51227,-0.68486c1.34106,-1.13379 1.96038,-2.70505 1.96038,-3.90848c0,0 1.28043,2.07835 1.72281,2.0251c0.20562,-0.02458 0.47596,-1.13871 -0.35882,-3.8282'

export const PATH_LINE =
  'm19.00397,9.96752c0.33189,0 0.59912,0.27103 0.59912,0.60007c0,0.32809 -0.26723,0.59912 -0.59912,0.59912l-1.66897,0l0,1.06985l1.66897,0c0.33189,0 0.59912,0.26913 0.59912,0.59912c0,0.32714 -0.26723,0.59817 -0.59912,0.59817l-2.26904,0c-0.32809,0 -0.59626,-0.27103 -0.59626,-0.59817l0,-4.53713c0,-0.32809 0.26818,-0.59912 0.59912,-0.59912l2.26904,0c0.32904,0 0.59626,0.27103 0.59626,0.59912c0,0.33189 -0.26723,0.59912 -0.59912,0.59912l-1.66897,0l0,1.06985l1.66897,0zm-3.66603,2.86816c0,0.25676 -0.16547,0.485 -0.41082,0.56678c-0.06086,0.01997 -0.12648,0.02948 -0.18925,0.02948c-0.20066,0 -0.37183,-0.08559 -0.485,-0.23775l-2.32325,-3.1544l0,2.79588c0,0.32714 -0.26532,0.59817 -0.60007,0.59817c-0.32904,0 -0.59531,-0.27103 -0.59531,-0.59817l0,-4.53713c0,-0.25676 0.16452,-0.485 0.40892,-0.56583c0.05706,-0.02187 0.12933,-0.03138 0.18449,-0.03138c0.18544,0 0.35662,0.0989 0.47074,0.24155l2.34131,3.16676l0,-2.8111c0,-0.32809 0.26818,-0.59912 0.59912,-0.59912c0.32809,0 0.59912,0.27103 0.59912,0.59912l0,4.53713zm-5.45958,0c0,0.32714 -0.26818,0.59817 -0.60007,0.59817c-0.32809,0 -0.59626,-0.27103 -0.59626,-0.59817l0,-4.53713c0,-0.32809 0.26818,-0.59912 0.59912,-0.59912c0.32904,0 0.59722,0.27103 0.59722,0.59912l0,4.53713zm-2.34512,0.59817l-2.26904,0c-0.32809,0 -0.59912,-0.27103 -0.59912,-0.59817l0,-4.53713c0,-0.32809 0.27103,-0.59912 0.59912,-0.59912c0.33094,0 0.59912,0.27103 0.59912,0.59912l0,3.93801l1.66992,0c0.33094,0 0.59817,0.26913 0.59817,0.59912c0,0.32714 -0.26818,0.59817 -0.59817,0.59817m15.87852,-3.03743c0,-5.10772 -5.12103,-9.26445 -11.41177,-9.26445s-11.41177,4.15674 -11.41177,9.26445c0,4.57517 4.06069,8.40857 9.54309,9.13702c0.37183,0.07798 0.87775,0.24535 1.00614,0.56108c0.11412,0.28625 0.07513,0.72845 0.03614,1.02706l-0.15596,0.97c-0.04279,0.28625 -0.22824,1.12786 0.99758,0.61338c1.22772,-0.51258 6.57698,-3.8781 8.97345,-6.63309c1.63949,-1.7964 2.4231,-3.63655 2.4231,-5.67545'

export const PATH_ICQ =
  'm10.50723,2.10553a3.12019,3.12019 0 0 0 -2.51907,4.88972l1.43558,2.11256a1.52959,1.52959 0 0 0 2.74913,-0.10719l1.19893,-2.41518l-0.00495,0a3.12019,3.12019 0 0 0 -2.85962,-4.47991zm7.56382,3.70729a3.49207,3.49207 0 0 0 -1.37044,0.25232a3.48795,3.48795 0 0 0 -1.49825,1.15111l-1.82561,2.33932c-0.02061,0.02639 -0.04123,0.05195 -0.06102,0.07916l-0.00825,0.00989a1.72171,1.72171 0 0 0 1.24428,2.72604l2.98001,0.44197l-0.00247,-0.00577a3.51186,3.51186 0 0 0 3.73697,-4.7883a3.51598,3.51598 0 0 0 -3.19522,-2.20574zm-13.00848,2.26428a2.60071,2.60071 0 0 0 -2.50341,1.96743a2.59823,2.59823 0 0 0 3.21831,3.13668l2.09359,-0.60771a1.27397,1.27397 0 0 0 0.61183,-2.20409l-1.60297,-1.56999l0,0.00412a2.58092,2.58092 0 0 0 -1.81736,-0.72645zm8.50466,5.53866a1.55515,1.55515 0 0 0 -1.53206,1.84127l0.31911,2.69059l0.00412,-0.00247a3.17131,3.17131 0 0 0 5.05794,2.12245a3.17131,3.17131 0 0 0 -0.74212,-5.4793l-2.3723,-0.98702a1.55845,1.55845 0 0 0 -0.73387,-0.18553l-0.00082,0zm-4.57639,0.06597c-0.31086,0 -0.61843,0.08576 -0.88724,0.24737l-2.65018,1.38446l0.00495,0.00247a3.47146,3.47146 0 0 0 -1.31355,1.22449a3.49619,3.49619 0 0 0 1.10658,4.81799a3.49537,3.49537 0 0 0 4.81964,-1.09833a3.47146,3.47146 0 0 0 0.5335,-1.79098l0.08905,-2.84478a1.71429,1.71429 0 0 0 -1.70027,-1.9427l-0.00247,0z'

// 对外映射：有品牌路径则优先使用；否则回退到 MDI 图标集
export const ICONS_BY_TYPE: Record<string, string> = {
  // System
  email: mdiEmail,
  event: mdiCalendar,
  inperson: mdiAccountMultiple,

  // Social/communication
  linkedin: mdiLinkedin,
  facebook: mdiFacebook,
  x: PATH_X,
  wechat: mdiWechat,
  phone: mdiPhone,
  qq: PATH_QQ,
  skype: mdiSkypeBusiness,
  telegram: PATH_TELEGRAM,
  icq: PATH_ICQ,
  whatsapp: mdiWhatsapp,
  line: PATH_LINE
}

// 品牌色（十六进制），用于部分平台图标着色
export const BRAND_COLORS: Record<string, string> = {
  x: '#000000',
  telegram: '#26A5E4',
  line: '#00C300',
  whatsapp: '#25D366',
  wechat: '#07C160',
  facebook: '#0866FF',
  linkedin: '#0A66C2',
  qq: '#12B7F5',
  skype: '#00AFF0',
  icq: '#4AF601'
}

export function getBrandColorByType(type: NoteType | string): string | undefined {
  return BRAND_COLORS[type]
}

export function getIconByType(type: NoteType | string): string {
  return ICONS_BY_TYPE[type] ?? mdiAccount
}
